home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / pcxpas.com / SHOWCGA.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-10-15  |  1.4 KB  |  48 lines

  1. program SHOWCGA;
  2.  
  3. (* Sample implementation of PCX.TPU for CGA. You need to have the
  4.    Turbo .BGI files in the current directory, or change Initgraph.
  5.    Enter a valid filename (without extension) on the command line
  6.    or, if you're running under Turbo, in the Parameters box.
  7.  
  8.    For 4-color images in the standard colors, just change Grmode to Cgac1 *)
  9.  
  10. uses GRAPH, DOS, CRT, PCX;
  11.  
  12. var   grdriver, grmode: integer;
  13.       textpage0: byte absolute $b800:0000;
  14.       page0: ^byte;
  15.       textsave: pointer;
  16.       cursorx, cursory: byte;
  17.  
  18. begin
  19. clrscr;
  20. writeln('This is a text screen, which we will save and restore.');
  21. writeln;
  22. write('Strike any key. ');
  23. cursorx:= wherex; cursory:= wherey;
  24. page0:= @textpage0;
  25. getmem(textsave, 4000);
  26. move(page0^, textsave^, 4000);               { Save text screen }
  27. repeat until readkey <> #1;
  28. pcxfilename:= paramstr(1) + '.PCX';
  29. grdriver:= cga; grmode:= cgahi;              { 2-color 640x200 format }
  30. initgraph(grdriver, grmode, '');
  31. read_pcx_file(grdriver, pcxfilename);
  32. if file_error then
  33. begin
  34.   closegraph;
  35.   writeln('File ', fexpand(pcxfilename), ' not found.');
  36.   halt;
  37. end;
  38. move(buff1^, screenbuff1, 8000);             { Display the image }
  39. move(buff2^, screenbuff2, 8000);
  40. repeat until readkey <> #1;
  41. closegraph;
  42. move(textsave^, page0^, 4000);               { Restore text screen }
  43. gotoxy(cursorx, cursory);
  44. freemem(textsave, 4000);
  45. repeat until readkey <> #1;
  46. clrscr;
  47. end.
  48.